<?php
    class Database{
        private $con;
        private $host;
        private $user;
        private $pass;
        private $db;
        private $sql;
        private $result;
        
        function __construct($host, $user, $pass){
            $this->host = $host;
            $this->user = $user;
            $this->pass = $pass;
            $this->db = "";
            $this->con = mysql_connect($this->host, $this->user, $this->pass) or die(mysql_error());
            $this->sql = "";
            $this->result = "";
        }
        
        public function connect($db){
			$this->db = $db;
            mysql_select_db($this->db, $this->con) or die(mysql_error());
        }
        
        public function disconnect(){
            mysql_close($this->con);
        }
        
        public function executeQuery($query){
        	$this->sql = $query;
            $this->result = mysql_query($this->sql, $this->con) or die(mysql_error());
			return $this->result;
        }
		
		public function getResultLine($type){
			return mysql_fetch_array($this->result, $type);
		} 
		
		public function getResult(){
			return $this->result;
		}
    }

?>